
import request from "@/utils/request";
// 获取商品展示列表信息，可以根据关键字查找，也可以根据分类查找
export const commodityListService = (pageNum, keyword, categoryId) => {
    const params = {
        pageNum,
        keyword,
        categoryId
    };
    return request.post("/commodity/list", params, {
        headers: {
            'Content-Type': 'application/json'
        }
    })
}

// 根据id获取商品属性信息
export const commodityAttributeService = (commodityId) => {
    const params = new URLSearchParams();
    params.append("commodityId", commodityId);
    
    return request.post("/commodity/getCommodityAttributeById", params)
}

// 根据id获取商品参数信息
export const commodityDetailService = (commodityId) => {
    const params = new URLSearchParams();
    params.append("commodityId", commodityId);
    
    return request.post("/commodity/getDetailById", params)
}

// 根据关键字搜索商品
export const searchCommodityService = (pageNum, keyword) => {
    const params = new URLSearchParams();
    
    return request.post("/commodity/list", params)
}